|
Microwave filters GUI
2.0.3
|
Specification mask class. More...
Public Member Functions | |
| def | __init__ |
| Read specification mask from file. | |
| def | specToMask |
| Process specification data to obtain the mask curves. | |
| def | maskSamplesOptimization |
| Create mask samples to be used as a reference in optimization. | |
| def | dataSymmetrizeDeltaF0 |
| Sort and symmetrise data with respect to centre frequency self.f0 and add self.f0 to frequency column of array. | |
| def | freqSort |
| Sort array by frequency (inplace). | |
Specification mask class.
Definition at line 218 of file mwfiltersgui.py.
| def mwfiltersgui.SpecMask.__init__ | ( | self, | |
| fileName, | |||
parent = None |
|||
| ) |
Read specification mask from file.
@param fileName = File Name
@param parent = Parent window for the temperature variation dialog
Open a widget to get temperature variation parameters: Tamb = Ambient Temperature: Temperature at which the filter is built. At ambient temperature, the measured [S] parameters correspond to the designed [S] parameters. Tmax = Maximum operating temperature. Due to thermal expansion, the filter at Tmax is actually larger than the filter built at Tamb and the [S] parameters are shifted to the left (to lower frequencies). Tmin = Minimum operating temperature. Due to thermal expansion, the filter at Tmin is actually smaller than the filter built at Tamb and the [S] parameters are shifted to the right (to higher frequencies). alpha = Thermal expansion coefficient, expressed in parts per million per degree Celsius. Example: 22 ppm/C for alumminium. @return freqShiftRight = Relative frequency shift of the mask to the right = alpha*(Tmax-Tamb)*1e-6. @return freqShiftLeft = Relative frequency shift of the mask to the left = alpha*(Tamb-Tmin)*1e-6.
Helper function that returns next item that does not start with '!' of iterLines iterator.
Items returned by iterLines iterator must be strings.
@return line = First item that does not start with '!' Helper function that returns the conversion factor corresponding to 'units' argument.
@param units = Units. Must be a key in the unitsFactorDict dictionary. String.
@return factor = Frequency conversion factor Helper function that returns the data read form specification mask file.
The units conversion factors are applied.
@param line = String to process (line of specification mask file).
@return data = Numpy array containing the data.
@return line = String containing next non-comment line of specification mask file after the data, normally starting with '#'.File name Parent window Central frequency Bandwidth Specification for S11 (return losses) in dB. Float. Value of S21 at f0 Value of S21 over bandwidth Specification for S21 variation over bandwidth (insertion losses) in dB pk-pk. Numpy float array Nx2 where N is the number of points, frequency data (Hz) is in the 1st column and Mask data in the 2nd. Specification for S21 out of band rejection in dB. Numpy float array Nx2 where N is the number of points, frequency data (Hz) is in the 1st column and Mask data in the 2nd. Group delay mask (sec). Numpy float array Nx2 where N is the number of points, frequency data (Hz) is in the 1st column and Mask data in the 2nd. Frequency samples in the pass band for optimization Frequency samples in the rejection band for optimization Array with all frequency samples for optimization, in Hz, the first self.NfreqInBandOptim correspond to self.freqInbandOptim and the rest ot self.freqOutBandOptim Array with all frequency samples for optimization, in normalized s-plane, the first self.NfreqInBandOptim correspond to self.freqInbandOptim and the rest ot self.freqOutBandOptim Number of samples in self.evalSoptim corresponding to the pass band = len(self.freqInbandOptim) S11 mask samples in the pass band for optimization S21 mask samples in the pass band for optimization S21 mask samples in the rejection band for optimization Factor to multiply the frequencies that shift to the right Factor to multiply the frequencies that shift to the left
Definition at line 226 of file mwfiltersgui.py.
References mwfiltersgui.SpecMask.BW, libcommonfunc.FrequencyTransformBP.BW, libcommonfunc.criticalErrorMsg(), mwfiltersgui.SpecMask.evalFoptim, mwfiltersgui.SpecMask.evalSoptim, mwfiltersgui.SpecMask.f0, libcommonfunc.Sparameters.f0, libcommonfunc.FrequencyTransformBP.f0, mwfiltersgui.SpecMask.fileName, mwfiltersgui.SpecMask.freqFactorLeft, mwfiltersgui.SpecMask.freqFactorRight, mwfiltersgui.SpecMask.freqInbandOptim, mwfiltersgui.SpecMask.freqOutBandOptim, mwfiltersgui.SpecMask.GDspec, dbplot.DbPlot.mainWindow, mwfiltersgui.SpecMask.mainWindow, dbplot.AxisScalingDlg.mainWindow, dbplot.EditCurvesDlg.mainWindow, libcommonfunc.myPrint(), mwfiltersgui.SpecMask.NfreqInBandOptim, mwfiltersgui.SpecMask.S11optim, mwfiltersgui.SpecMask.S11spec, mwfiltersgui.SpecMask.S21_BW, mwfiltersgui.SpecMask.S21_F0, mwfiltersgui.SpecMask.S21inBandOptim, mwfiltersgui.SpecMask.S21inbandSpecDelta, mwfiltersgui.SpecMask.S21outBandOptim, and mwfiltersgui.SpecMask.S21outbandSpec.

| def mwfiltersgui.SpecMask.dataSymmetrizeDeltaF0 | ( | self, | |
| inArray, | |||
| freqCol, | |||
hideBW = False |
|||
| ) |
Sort and symmetrise data with respect to centre frequency self.f0 and add self.f0 to frequency column of array.
Frequencies in the input array are delta with respect to centre frequency self.f0. Frequencies in the result are absolute.
| inArray | = Input numpy array. |
| freqCol | = Column index of frequency values. |
| hideBW | = Flag to hide the centre of the mask. If True, the mask is not displayed at the centre, between the symmetric data points. Default False. |
Definition at line 607 of file mwfiltersgui.py.
References mwfiltersgui.SpecMask.f0, libcommonfunc.Sparameters.f0, libcommonfunc.FrequencyTransformBP.f0, and mwfiltersgui.SpecMask.freqSort().
Referenced by mwfiltersgui.SpecMask.specToMask().


| def mwfiltersgui.SpecMask.freqSort | ( | self, | |
| inArray, | |||
| freqCol | |||
| ) |
Sort array by frequency (inplace).
The input array is modified inplace
| inArray | = Input numpy array. |
| freqCol | = Column index of frequency values. |
Definition at line 631 of file mwfiltersgui.py.
References mwfiltersgui.SpecMask.BW, libcommonfunc.FrequencyTransformBP.BW, mwfiltersgui.SpecMask.f0, libcommonfunc.Sparameters.f0, libcommonfunc.FrequencyTransformBP.f0, mwfiltersgui.SpecMask.GDmaskLower, mwfiltersgui.SpecMask.GDmaskUpper, mwfiltersgui.SpecMask.GDspec, mwfiltersgui.SpecMask.S11mask, mwfiltersgui.SpecMask.S11spec, mwfiltersgui.SpecMask.S21_BW, mwfiltersgui.SpecMask.S21_F0, mwfiltersgui.SpecMask.S21inBandMask, mwfiltersgui.SpecMask.S21inbandSpecDelta, mwfiltersgui.SpecMask.S21outBandMask, and mwfiltersgui.SpecMask.S21outbandSpec.
Referenced by mwfiltersgui.SpecMask.dataSymmetrizeDeltaF0(), and mwfiltersgui.SpecMask.specToMask().

| def mwfiltersgui.SpecMask.maskSamplesOptimization | ( | self, | |
| FT, | |||
| Nsamples | |||
| ) |
Create mask samples to be used as a reference in optimization.
Half the samples go to the passband and half to the rejection band (symmetrically). The frequency samples for optimization are obtained by linear interpolation of the mask data. Only the magnitude of [S] is optimized to comply with the S11 and S21 masks. Group delay in the mask file, if any, is not used in optimization,
| FT | = FrequencyTransform class instance, containing f0 and BW parameters. |
| Nsamples | = Total number of samples. Half go to the passband and half to the rejection band (symmetrically). |
Definition at line 543 of file mwfiltersgui.py.
References mwfiltersgui.SpecMask.evalFoptim, mwfiltersgui.SpecMask.evalSoptim, mwfiltersgui.SpecMask.f0, libcommonfunc.Sparameters.f0, libcommonfunc.FrequencyTransformBP.f0, mwfiltersgui.SpecMask.freqInbandOptim, mwfiltersgui.SpecMask.freqOutBandOptim, mwfiltersgui.SpecMask.GDmaskLower, mwfiltersgui.SpecMask.GDmaskUpper, mwfiltersgui.SpecMask.NfreqInBandOptim, mwfiltersgui.SpecMask.S11mask, mwfiltersgui.SpecMask.S11optim, mwfiltersgui.SpecMask.S21_BW, mwfiltersgui.SpecMask.S21_F0, mwfiltersgui.SpecMask.S21inBandMask, mwfiltersgui.SpecMask.S21inBandOptim, mwfiltersgui.SpecMask.S21outBandMask, and mwfiltersgui.SpecMask.S21outBandOptim.
| def mwfiltersgui.SpecMask.specToMask | ( | self, | |
| SP | |||
| ) |
Process specification data to obtain the mask curves.
The mask values are computed from specification relative values adding the relevant [S] parameter data.
@param SP = Sparameters class instance
Apply frequency shift to mask. @param mask = Mask numpy array @param type = 'outer' or 'inner'. 'outer' masks expand: the right freq shift is applied to the left portion of the data and the left frequency shift to the right portion. 'inner' masks collapse: the left freq shift is applied to the left portion of the data and the right frequency shift to the right portion.
Mask for S11 (return losses) as a function of frequency. Numpy array. Mask for S21 inband (insertion losses) Mask for out-of-band rejection as a function of frequency. Numpy array. Mask for group delay (upper). Mask for group delay (lower).
Definition at line 440 of file mwfiltersgui.py.
References mwfiltersgui.SpecMask.BW, libcommonfunc.FrequencyTransformBP.BW, mwfiltersgui.SpecMask.dataSymmetrizeDeltaF0(), mwfiltersgui.SpecMask.f0, libcommonfunc.Sparameters.f0, libcommonfunc.FrequencyTransformBP.f0, mwfiltersgui.SpecMask.freqFactorLeft, mwfiltersgui.SpecMask.freqFactorRight, mwfiltersgui.SpecMask.freqSort(), mwfiltersgui.SpecMask.GDmaskLower, mwfiltersgui.SpecMask.GDmaskUpper, mwfiltersgui.SpecMask.GDspec, mwfiltersgui.SpecMask.S11mask, mwfiltersgui.SpecMask.S11spec, mwfiltersgui.SpecMask.S21_BW, mwfiltersgui.SpecMask.S21_F0, mwfiltersgui.SpecMask.S21inBandMask, mwfiltersgui.SpecMask.S21inbandSpecDelta, mwfiltersgui.SpecMask.S21outBandMask, and mwfiltersgui.SpecMask.S21outbandSpec.

1.8.1.2